Repository navigation
Fix the strict lint failures, and build the examples in CI - #3
Merged
Merged
Conversation
--strict was turned on against a baseline I had only partly checked, so eight violations failed the first run. Four were genuine: `?? nil` on an expression already returning an optional into an Any? return type, redundant in all four cases and removed. The rest are style the codebase chose deliberately — else-if chains on their own lines, and the character scanner's branch count — so statement_position is disabled and the complexity threshold raised, both with a note saying why. The one force unwrap is a fixed CFURLPathStyle raw value that cannot fail, silenced at the line rather than by dropping the rule. The examples now build in CI as a separate package depending on this one by path, the way a consumer would, since nothing else compiles that file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The first run with
--strictfailed with eight violations. This fixes them, adds a CI job that compilesExamples/, and adds the 1.0.1 changelog entry.The violations
Genuinely redundant, fixed in code. Four
?? nilcoalescings inexecuteAppleScript(_:with:), e.g.result.stringValue ?? nil. The expression is already optional and the return type isAny?, so they did nothing. Same results, same types.Deliberate style, rules disabled with a note.
statement_positionflagged theelse ifchains in the character scanner — the same category ascolonandswitch_case_alignment, already disabled.cyclomatic_complexityputparseSimpleAppleScriptRecordat 16 against a threshold of 15; raised to 20, since splitting a scanner across functions would make it harder to follow.Silenced at the line. The single
force_unwrapping,CFURLPathStyle(rawValue: 1)!, where the raw value is a constant that cannot fail. The rule stays on for everything else.Examples in CI
Examples/AppleScripts.swiftisn't part of any target, so nothing was compiling it and it could rot unnoticed. The newBuild examplesjob assembles a throwaway package that depends on this one by path — the way a real consumer does — and builds it in Swift 5 language mode. Verified by running the same steps locally.For the reviewer
No public API change, and no behaviour change. 1.0.1 is docs, examples, lint config and CI.
The Swift 5 language mode in the examples job is not incidental:
AppleScriptObjectis notSendable, so thestatic letscript constants do not compile under Swift 6 mode. That is documented in the README and tracked in #2.